// ignore_for_file: file_names

import 'package:flutter/material.dart';

class ExpandedComp extends StatelessWidget {
  const ExpandedComp({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Expanded布局'),
        backgroundColor: Colors.red,
      ),
      body: Center(
        child: Container(
          height: 100,
          color: Colors.cyan,
          child: Row(
            children: [
              // 占1/7
              Expanded(
                flex: 1,
                child: Container(
                    height: 86,
                    color: Colors.red,
                    child: const Row(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Text('我是红色'),
                      ],
                    )),
              ),
              // 占4/7
              Expanded(
                  flex: 4,
                  child: Container(
                    height: 86,
                    color: Colors.green,
                  )),
              // 占2/7
              Expanded(
                  flex: 2,
                  child: Container(
                    height: 86,
                    color: Colors.pink,
                  )),
            ],
          ),
        ),
      ),
    );
  }
}
